package com.gw.consumer.service;

import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;

@Component
public class ConsumerService {
    //监听点对点模式的消息
    @JmsListener(destination = "myQueue",containerFactory="queueListenerFactory")
    public void receiveQueue(String message){
        System.out.println("Queue接收到："+message);
    }
    //监听发布订阅模式的消息
    @JmsListener(destination = "myTopic",containerFactory = "topicListenerFactory")
    public void receiveTopic(String message){
        System.out.println("Topic接收到："+message);
    }
}
